package com.sinosoft.front;

import java.net.MalformedURLException;
import java.rmi.RemoteException;

import javax.xml.rpc.ServiceException;

import com.sinosoft.front.dto.CarQueryService.out.xsd.CarQueryInfo;
import com.sinosoft.front.dto.common.xsd.IinsuranceExtensionEhm;
import com.sinosoft.front.dto.common.xsd.TxInsuranceRequestEhm;
import com.sinosoft.front.dto.common.xsd.TxInsuranceRequestExtensionEhm;
import com.sinosoft.front.dto.vehicleModelQuery.out.xsd.VehicleModelData;
import com.sinosoft.front.dto.xsd.CarQueryRequest;
import com.sinosoft.front.dto.xsd.CarQueryResponse;
import com.sinosoft.front.dto.xsd.VehicleModelQueryRequest;
import com.sinosoft.front.dto.xsd.VehicleModelQueryResponse;
import com.sinosoft.front.service.CarQueryServicePortType;
import com.sinosoft.front.service.CarQueryServicePortTypeProxy;
import com.sinosoft.front.service.VehicleModelQueryServicePortType;
import com.sinosoft.front.service.VehicleModelQueryServicePortTypeProxy;


public class CarQueryTest {
	
	
	public static void main(String[] args) throws RemoteException, ServiceException, MalformedURLException {
		//调用服务器端方法
		CarQueryServicePortTypeProxy proxy = new CarQueryServicePortTypeProxy();
		proxy.setEndpoint("http://proxy.tuxing51.com/frontServiceCenter/services/CarQueryService?wsdl");
		CarQueryServicePortType portType = proxy.getCarQueryServicePortType();
		
		
		//请求头信息
		CarQueryRequest request = new CarQueryRequest();
		TxInsuranceRequestEhm requestEhm = new TxInsuranceRequestEhm();
		requestEhm.setTransExeDate("2017-3-17");//交易日期
		requestEhm.setTransExeTime("12:24:34");//交易时间
		request.setTxInsuranceRequestEhm(requestEhm);
		
		requestEhm.setIinsuranceExtensionEhm(new IinsuranceExtensionEhm());
	
		//请求头数据
		TxInsuranceRequestExtensionEhm extensionEhm = new TxInsuranceRequestExtensionEhm();
		extensionEhm.setOperator("HN1_Test");//用户名
		extensionEhm.setOperatorKey("123456");//密码
		request.setTxInsuranceRequestExtensionEhm(extensionEhm );
		
		
		//入口参数
		request.setPolicySort("HN1");   //系统来源
		request.setLicenseNo("豫GSD122");//车牌号码
		request.setLicenseType("02");   // 号牌种类代码
		request.setFranchiserCode("4105979018");//经销商代码		
		request.setCityAreaCode("410500");//城市代码
		
		
		CarQueryResponse response = portType.carQuery(request);
		System.out.println(response.getTxInsuranceResponseEhm().getTransResultEhm().getResultCode());
		System.out.println(response.getTxInsuranceResponseEhm().getTransResultEhm().getResultInfoDesc());
		System.out.println(response.getTxInsuranceResponseEhm().getTransResultEhm().getErrorNo());
		
		//获取返回信息
		CarQueryInfo[] carQueryInfoArr = response.getCarQueryInfoArr();
		for (CarQueryInfo carQueryInfo : carQueryInfoArr) {
			System.out.println("车辆型号:"+carQueryInfo.getBrandName());
			System.out.println("车牌号码:"+carQueryInfo.getLicenseNo());
		}
		
		

	}

}